# Maintainer: Wu Zhenyu <wuzy01@qq.com>

_realname=vivid
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.10.1
pkgrel=1
pkgdesc='A themeable LS_COLORS generator with a rich filetype datebase (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/sharkdp/vivid'
msys2_references=(
  'archlinux: vivid'
  'purl: pkg:cargo/vivid'
)
license=('spdx:MIT OR Apache-2.0')
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
options=('!strip')
source=("${url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('88db6158dad60aba66ae16f2cd1b09f515625940a33bada65da5562a03538e49')

prepare() {
  cd "vivid-${pkgver}"

  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "vivid-${pkgver}"

  cargo build --release --frozen
}

package() {
  cd "vivid-${pkgver}"

  install -Dt "${pkgdir}${MINGW_PREFIX}/bin" target/release/vivid
  install -Dm644 LICENSE-{APACHE,MIT} -t "${pkgdir}${MINGW_PREFIX}/share/licenses/vivid"
}
